<template>
<div>
<el-table  :data="tablerole" >
  <el-table-column   type="index" label="#"></el-table-column>
  <el-table-column label="权限名称"  prop="authName"></el-table-column>
  <el-table-column label="路径" prop="path"></el-table-column>
  <el-table-column label="权限" prop="level">
      <template slot-scope="scope">
        <el-tag v-if="scope.row.level==0">一级权限</el-tag>
<el-tag  v-else-if="scope.row.level==1" type="success">二级权限</el-tag>

<el-tag v-else type="warning">三级权限</el-tag>
      </template></el-table-column></el-table>
</div>
</template>

<script>
import { rolego } from "@/http/api";
export default {
  name: '',  // 
  
  components: {},//引入子  
  data () {//数据
    return {
        tablerole:[]
    }
  },
  created () { 
    this.gets()

  },//todo钩子函数 实例创建之前 
  mounted () { },//真实dom挂载之后，运行，这时可以访问dom元素
  methods: {
    async gets(){
        const res=await rolego('list')
        this.tablerole=res
        console.log(res);
    }
  },//!事件函数
  computed:{} , //计算属性
  watch:{ //监听属性
   a: {
deep: true,
immediate: true,
handler(newval){},
}
}
}
</script>
<style scoped lang='scss'>

</style>
